class CreateAuditsTable < ActiveRecord::Migration #:nodoc:
  def self.up
    create_table :audits do |t|
      t.references :audited, :polymorphic => true, :null => false
      t.references :user
      t.text :change_set, :null => false

      t.datetime :created_at, :null => false
    end

    add_index :audits, [:audited_id, :audited_type]
    add_index :audits, [:user_id]
  end

  def self.down
    drop_table :audits
  end
end
